﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
	<link href="js-console.css" rel="stylesheet" />
	<!-- 7. Write a script that finds the greatest of given 5 variables. -->
</head>
<body>
	<div id="js-console"></div>
	<script src="js-console.js"></script>
	<script>
		//Read input
		var a = prompt("Enter a");
		var b = prompt("Enter b");
		var c = prompt("Enter c");
		var d = prompt("Enter d");
		var e = prompt("Enter e");

		if (!isNaN(a) && !isNaN(b) && !isNaN(c) && !isNaN(d) && !isNaN(e)) {
			a *= 1; b *= 1; c *= 1; d *= 1; e *= 1;	// make them real number

			var greatest = a;

			// Make comparisons
			if (b > greatest)
			{ greatest = b; }

			if (c > greatest)
			{ greatest = c; }

			if (d > greatest)
			{ greatest = d; }

			if (e > greatest)
			{ greatest = e; }

			// Print greatest
			jsConsole.writeLine("The greatest of 5 numbers is: " + greatest);
		}
		else {
			jsConsole.writeLine("Wrong input.");
		}
	</script>
</body>
</html>
